package com.qfedu.aunt.commons.controller;


import com.qfedu.aunt.commons.pojo.AuntSkill;
import com.qfedu.aunt.commons.result.R;
import com.qfedu.aunt.commons.service.InformationEvaluationService;
import com.qfedu.aunt.commons.vo.InformationEvaluationVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 信息评估表 前端控制器
 * </p>
 *
 * @author xiaobobo
 * @since 2022-10-26
 */
@RestController
@RequestMapping("/aunt/commons/information/evaluation")
@Api(description = "信息评估模块",tags = "信息评估模块")
public class InformationEvaluationController {

    @Autowired
    private InformationEvaluationService informationEvaluationService;

    /**
     * 信息评估模块上 获取我们的手机验证码
     * @return
     */
    @ApiOperation(value = "通过电话号码获取验证码")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "telPhoneNumber",value = "电话号码",dataType = "int",paramType = "path",required = true),
            @ApiImplicitParam(name = "token",value = "用户身份标识",dataType = "string",paramType = "header",required = true)
    })
    @GetMapping("/getCode/{telPhoneNumber}")
    public R getCode(@PathVariable("telPhoneNumber") String telPhoneNumber){
        informationEvaluationService.getCode(telPhoneNumber);
        return R.ok();
    }

    /**
     * 获取静态字典的数据
     * @return
     */
    @ApiOperation("获取静态字典的数据")
    @ApiImplicitParam(name = "token",value = "用户身份标识",dataType = "string",paramType = "header",required = true)
    @GetMapping("/getStaticDictionary")
    public R getStaticDictionary(){
        HashMap<String, List<AuntSkill>> maps=informationEvaluationService.getStaticDictionary();
        return R.ok().setMapData(maps);
    }


    /**
     * 添加信息评估的数据
     * @param informationEvaluationVo
     * @return
     */
    @ApiOperation("添加信息评估")
    @ApiImplicitParam(name = "token",value = "用户身份标识",dataType = "string",paramType = "header",required = true)
    @PostMapping("/addInformationEvaluation")
    public R addInformationEvaluation(@RequestBody InformationEvaluationVo informationEvaluationVo) throws InvocationTargetException, IllegalAccessException {
        informationEvaluationService.add(informationEvaluationVo);
        return R.ok();
    }





}

